package com.jiaai.cloud.base;

import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/7/3.
 */
public class CacheServiceImpl<M extends com.baomidou.mybatisplus.mapper.BaseMapper<T>, T> extends ServiceImpl<M,T> {


    @Override
    @CachePut
    public boolean insert(T entity) {
        return super.insert(entity);
    }

    @Override
    @CachePut
    public boolean insertAllColumn(T entity) {
        return super.insertAllColumn(entity);
    }

    @Override
    @CachePut
    public boolean insertBatch(List<T> entityList) {
        return super.insertBatch(entityList);
    }

    @Override
    @CachePut
    public boolean insertBatch(List<T> entityList, int batchSize) {
        return super.insertBatch(entityList, batchSize);
    }

    @Override
    @CachePut
    public boolean insertOrUpdate(T entity) {
        return super.insertOrUpdate(entity);
    }

    @Override
    @CachePut
    public boolean insertOrUpdateBatch(List<T> entityList) {
        return super.insertOrUpdateBatch(entityList);
    }

    @Override
    @CachePut
    public boolean insertOrUpdateBatch(List<T> entityList, int batchSize) {
        return super.insertOrUpdateBatch(entityList, batchSize);
    }

    @Override
    @CachePut
    public boolean deleteById(Serializable id) {
        return super.deleteById(id);
    }

    @Override
    @CacheEvict
    public boolean deleteByMap(Map<String, Object> columnMap) {
        return super.deleteByMap(columnMap);
    }

    @Override
    @CacheEvict
    public boolean delete(Wrapper<T> wrapper) {
        return super.delete(wrapper);
    }

    @Override
    @CacheEvict
    public boolean deleteBatchIds(List<? extends Serializable> idList) {
        return super.deleteBatchIds(idList);
    }

    @Override
    @CachePut
    public boolean updateById(T entity) {
        return super.updateById(entity);
    }

    @Override
    @CachePut
    public boolean updateAllColumnById(T entity) {
        return super.updateAllColumnById(entity);
    }

    @Override
    @CachePut
    public boolean update(T entity, Wrapper<T> wrapper) {
        return super.update(entity, wrapper);
    }

    @Override
    @CachePut
    public boolean updateBatchById(List<T> entityList) {
        return super.updateBatchById(entityList);
    }

    @Override
    @CachePut
    public boolean updateBatchById(List<T> entityList, int batchSize) {
        return super.updateBatchById(entityList, batchSize);
    }

    @Override
    @Cacheable
    public T selectById(Serializable id) {
        return super.selectById(id);
    }

    @Override
    @Cacheable
    public List<T> selectBatchIds(List<? extends Serializable> idList) {
        return super.selectBatchIds(idList);
    }

    @Override
    @Cacheable
    public List<T> selectByMap(Map<String, Object> columnMap) {
        return super.selectByMap(columnMap);
    }

    @Override
    @Cacheable
    public T selectOne(Wrapper<T> wrapper) {
        return super.selectOne(wrapper);
    }

    @Override
    @Cacheable
    public Map<String, Object> selectMap(Wrapper<T> wrapper) {
        return super.selectMap(wrapper);
    }

    @Override
    @Cacheable
    public Object selectObj(Wrapper<T> wrapper) {
        return super.selectObj(wrapper);
    }

    @Override
    @Cacheable
    public int selectCount(Wrapper<T> wrapper) {
        return super.selectCount(wrapper);
    }

    @Override
    @Cacheable
    public List<T> selectList(Wrapper<T> wrapper) {
        return super.selectList(wrapper);
    }

    @Override
    @Cacheable
    public Page<T> selectPage(Page<T> page) {
        return super.selectPage(page);
    }

    @Override
    @Cacheable
    public List<Map<String, Object>> selectMaps(Wrapper<T> wrapper) {
        return super.selectMaps(wrapper);
    }

    @Override
    @Cacheable
    public List<Object> selectObjs(Wrapper<T> wrapper) {
        return super.selectObjs(wrapper);
    }

    @Override
    @Cacheable
    public Page<Map<String, Object>> selectMapsPage(Page page, Wrapper<T> wrapper) {
        return super.selectMapsPage(page, wrapper);
    }

    @Override
    @Cacheable
    public Page<T> selectPage(Page<T> page, Wrapper<T> wrapper) {
        return super.selectPage(page, wrapper);
    }
}
